package com.koutao.mall.common;

import io.swagger.annotations.ApiModelProperty;

/**
 * Date:     2020/9/27 16:26
 * Description: TODO
 */
public class ResultData<T> {

    @ApiModelProperty("结果code")
    private int code;
    @ApiModelProperty("结果说明")
    private String msg;
    @ApiModelProperty("业务数据")
    private T data;


    public ResultData(ResultCode resultCode) {
        this.code = resultCode.code;
        this.msg = resultCode.msg;
    }

    public ResultData(T data){
        this(ResultCode.OK);
        this.data = data;
    }

    public ResultData(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public T getData() {
        return data;
    }
}
